Learning Flex Basics (Part 3) : Working with Containers
Robert Crooks
Table of Contents
- Introduction
- Building the Containers
- Create the Application Object
- Create a Data Array
- Add a TabNavigator Container for Global Navigation
- Add an HBox and Panel Containers for Main Views
- Add a ViewStack, LinkBar, and Panel Containers for Secondary Views
- Add a Form Container
- Add a Tile Layout Container and Populate It Using a Repeater
- Create a Pseudo Bar Chart Using a Repeater and VBoxes
- Complete Code Listing for containers.mxml
- Where to Go from Here
In this tutorial you will work with navigation and layout containers to create an application with multiple views. You learn to use several layout containers and the Repeater class, which iterates over an array of data. You also learn how to handle events for items that a Repeater class generates.
This tutorial is the third part in a four-part series written by Robert Crooks of the Macromedia Customer Training group:
- Learning Flex Basics (Part 1): Creating Your First Flex Application
- Learning Flex Basics (Part 2): Creating a Flex Calculator
- Learning Flex Basics (Part 4): Working with Data Models
If you prefer, you can download the entire set of tutorials.
-
Learning
Flex Series (Parts 1-4) (144 KB)
If you like what you see and want to get more experience with Flex, Macromedia Customer Training offers Fast Track to Macromedia Flex, a two-day onsite training course to jump-start Flex development in your organization. Now let's get started!
What you will learn
- How to use the Application tag.
- How to use the TabNavigator.
- How to use the ViewStack.
- How to use the LinkBar.
- How to use a Panel container.
- How to use the HBox.
- How to use the VBox.
- How to use the Form container.
- How to use the Tile container.
- How to use the Repeater class.
- How to use Label controls.
- How to use Button controls.
- How to create an array in ActionScript.
- How to create event handlers for events on repeated items in ActionScript.
Requirements
To complete this tutorial you will need to install the following software and files:
Macromedia Flex
(Installed and running on any server and platform supported by Flex. Note that the Flex trial is available on CD from the Macromedia store for $8.99. To learn more about the Flex trial, please read the Flex Frequently Asked Questions.)
Dreamweaver MX 2004 or a text editor that you can use to write XML and ActionScript code (a basic text editor such as Notepad is adequate)
Solution files for the tutorial:
container.zip (contains
the complete source code for containers.mxml in this article)
Prerequisite knowledge:
- Read A Brief Overview of Flex.
- You must know how to browse a Flex application.
- You should have completed Learning Flex Basics (Part 1): Creating Your First Flex Application and Learning Flex Basics (Part 2): Creating a Flex Calculator or have a basic understanding of how Flex applications work.